package com.chejianer.phone.service;

import com.chejianer.phone.domain.entity.Student;
import com.chejianer.phone.utils.ExcelUtils;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;

/**
 * Created by Chejianer on 2016/8/31.
 */
@Service
public class ExcelServiceImpl implements ExcelService{
    @Override
    public void toOutExcel(HttpServletResponse response) {
        ArrayList<Student> studentList=new ArrayList<Student>();
        Student student=new Student();
        student.setStuId(1);
        student.setStuName("倒萨");
        student.setStuSex("男");
        Student student2=new Student();
        student2.setStuId(2);
        student2.setStuName("萨法");
        student2.setStuSex("女");
        studentList.add(student);
        studentList.add(student2);
        String[] headers={"学号","姓名","性别"};
        ExcelUtils.excelOut(response,studentList,headers);
    }
}
